Add Bivariate Distributions lecture - #837
Merged
Merged
Conversation
Adds a new lecture introducing bivariate distributions, placed after fitting_distributions and before lln_clt in the Probability and Distributions part of the toc. Covers joint/marginal distributions (discrete and continuous), independence, covariance and correlation, ways joint distributions arise (independent components; Y = aX + b + U), the bivariate normal distribution, and a counterexample showing normal marginals don't imply joint normality. Moves to observed data using the Ames house price dataset already used in observed_distributions/fitting_distributions, fits a bivariate normal by the method of moments, and closes with a preview showing the bivariate normal's conditional mean coincides with the OLS line, handing off to simple_linear_regression. Built and rendered locally to verify execution and output. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
✅ Deploy Preview for taupe-gaufre-c4e660 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Move marginal distributions into the Discrete case and Continuous case subsections directly, rather than as a separate section after both, so discrete marginals (sums, bar charts) come first and continuous marginals (integrals, density curves) mirror them. - Split the Ames discrete example by mean instead of median, so the marginals are visibly asymmetric (~45%/38%) rather than ~50/50 by construction, tying back to the right-skew lesson from observed_distributions. - Add a heatmap of the joint PMF in the discrete case, and introduce the bivariate normal density (with 3D surface and contour plots) directly in the continuous case rather than in a separate later section. - Rename "The bivariate normal distribution" to "Back to the normal distribution", now picking up after Independence/Covariance/How joint distributions arise with the properties note, sample-draws figure, and the "word of caution" counterexample. - Explain what np.corrcoef returns and why [0, 1] is indexed, the first time it's used. - In "A word of caution": use 1 directly instead of an unnecessary parameter c, fix a leftover "houses" reference from the Ames example, and switch the counterexample to sns.jointplot so the normal marginals and non-normal joint are visible in one figure. Re-executed the full notebook (31 code cells) after each change; verified with a local jupyter-book build. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
sns.heatmap puts row 0 at the top by default, so with x=0 (below mean) at the top and x=1 (above mean) at the bottom, the diagonal of large cells ran top-left to bottom-right --- visually reading as a negative correlation even though the data is positively correlated. Add ax.invert_yaxis() to both heatmaps (the discrete joint heatmap and the actual-vs-independent comparison) so x increases upward, matching how a standard scatter plot reads. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
✅ Translation sync completed (zh-cn)Target repo: QuantEcon/lecture-intro.zh-cn
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new lecture, Bivariate Distributions, placed after
fitting_distributionsand beforelln_cltin the Probability and Distributions part.The three existing lectures in that part (
prob_dist,observed_distributions,fitting_distributions) all treat one variable at a time. This lecture is a quick, elementary bridge to pairs of variables, aimed at applied readers, before the series moves on tosimple_linear_regression/mle.Contents
Y = aX + b + Uobserved_distributions/fitting_distributions, now looking at price vs. floor area jointly (hexbin/jointplot, sample correlation)simple_linear_regressionVerification
yfinancedownload in the exercise) standalone — clean run, no errorsjupyter-book build bivariate_dist.md— notebook executed successfully (8.15s), HTML rendered correctly<figure>/<figcaption>wrapper), per the manual's guidance that captioned figures insidesolutiondirectives break the PDF build{doc}links and a bibtex key, expected for a standalone single-page build outside the full toc/bibliography context🤖 Generated with Claude Code